package com.enniswu.weitter.entity;

import android.support.annotation.Nullable;

import com.google.gson.annotations.SerializedName;
import com.google.gson.reflect.TypeToken;

import java.lang.reflect.Type;
import java.util.List;

public class JsonBean<T> {

    private int code;
    @SerializedName(value = "id", alternate = {"person", "post", "ids", "like", "follow", "image", "url"})
    private T t;
    @SerializedName("userId")
    private int mInt;

    public int getCode() {
        return code;
    }

    @Nullable
    public T getT() {
        return t;
    }

    public int getInt() {
        return mInt;
    }

    public static class TypeStore {

        public static final Type objType = new TypeToken<JsonBean<Object>>() {}.getType();
        public static final Type intType = new TypeToken<JsonBean<Integer>>() {}.getType();
        public static final Type strType = new TypeToken<JsonBean<String>>() {}.getType();
        public static final Type userType = new TypeToken<JsonBean<User>>() {}.getType();
        public static final Type postType = new TypeToken<JsonBean<Post>>() {}.getType();
        public static final Type intListType = new TypeToken<JsonBean<List<Integer>>>() {}.getType();
        public static final Type strListType = new TypeToken<JsonBean<List<String>>>() {}.getType();
    }
}
